import Taro, { Component } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import '../pages/index/index.scss';

export default class News extends Component {
  constructor() {
    super(...arguments)
    this.state = {
      
    }
  }

  config = {
    navigationBarTitleText: ''
  }

  componentWillMount() {
    console.log('mount')
   }

  componentDidMount() { }

  componentWillUnmount() { }

  componentDidShow() { 
    console.log('show')
  }

  componentDidHide() { }

  render() {
    const {data}=this.props;
    return (
      <View className='news'>
      {
        data.map((item,index)=>{
          return (
            <View className='at-article' key={index}>
              <View className='at-article__h1'>
                {item.title}
              </View>
              <View className='at-article__info'>
                <Text className='at-article__date'>{item.date}</Text>
                <Text>{item.author_name}</Text>
              </View>
              <View className='at-article__content'>
                <View className='at-article__section'>
                  <View className='at-article__p'></View>
                  <Image 
                    className='at-article__img' 
                    src={item.thumbnail_pic_s}
                    mode='widthFix' />
                </View>
              </View>
            </View>
          )
        })
      }
        
      </View>
    )
  }
}

